#ifndef GCONSOS_H
#define GCONSOS_H

#include <QWidget>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlRelationalTableModel>
#include <QSqlQueryModel>
#include <QTableWidgetItem>
#include <QInputDialog>

#include "consos.h"
#include "gcategories.h"

namespace Ui {
class GConsos;
}

class GConsos : public QWidget
{
    Q_OBJECT

public:
    explicit GConsos(QWidget *parent = 0);
    ~GConsos();

private:
    QSqlDatabase db;
    Ui::GConsos *ui;

    consos *current = NULL;
    consos *save = NULL;

    QSqlQueryModel *modelCategories;

    bool modCat;

private slots:
    void on_table_consos_clicked(const QModelIndex &index);
    void on_btn_add_motclef_clicked();
    void on_btn_sup_motclef_clicked();
    void on_btn_stock_clicked();
    void on_btn_annule_clicked();
    void on_text_nom_editingFinished();
    void on_text_com_editingFinished();
    void on_btn_nouveau_clicked();
    void on_spin_prix_editingFinished();
    void on_checkBox_2_stateChanged(int arg1);
    void on_categorie_currentIndexChanged(int index);
    void on_check_actif_clicked();
    void on_text_filtre_nom_textChanged(const QString &arg1);

    void clear_tab();
    void refresh();
    void refresh_tab();
    void enable_all(bool);
    void on_combo_filtre_categorie_currentIndexChanged(int index);
    void on_toolBox_currentChanged(int index);
};

#endif // GCONSOS_H
